import { defineStore } from "pinia";
import { UserState } from "@/stores/interface";
import piniaPersistConfig from "@/stores/helper/persist";

export const useUserStore = defineStore({
  id: "geeker-user",
  state: (): UserState => ({
    userData: "",
    token: ""
  }),
  getters: {},
  actions: {
    // Set Token
    setUserData(userData: any) {
      this.userData = userData;
    },
    setToken(token: string) {
      this.token = token;
    },
  },
  persist: piniaPersistConfig("geeker-user")
});
